FROM node as build
WORKDIR /app
COPY package*.json ./
RUN npm i
COPY . .
RUN npm run build

FROM nginx
RUN mkdir /app
COPY privatekey.pem /etc/nginx/privatekey.pem
COPY certificate.pem /etc/nginx/certificate.pem
COPY --from=build /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 80
